package cn.wen.core.titlebar;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;

import cn.wen.core.titlebar.base.BaseBarBuild;


/**
 * APP默认的通用标题构建器
 */

public class DefBarBuild extends BaseBarBuild<DefTitleBar> {

    // 2.所有效果的放置
    public CharSequence mTitle;
    public int mLeftResId;// 左边View的资源ID
    public int mLeftLayoutId;// 左边View的资源ID
    public View mLeftView;// 左边View的资源ID
    public int mRightLayoutId;// 左边View的资源ID
    public View mRightView;// 左边View的资源ID
    public int mBgColor;
    public CharSequence mRightText;
    public View.OnClickListener mRightTextClickListener;
    public View.OnClickListener mLeftClickListener;
    public int[] mRightResIcons;
    public View.OnClickListener[] mRightResClicks;

    public DefBarBuild(Activity activity) {
        super(activity);
    }

    public DefBarBuild(Activity activity, ViewGroup parent) {
        super(activity, parent);
    }

    @Override
    protected DefTitleBar getTitleBar() {
        return new DefTitleBar(this);
    }


    /**
     * 设置Title
     *
     * @param title
     * @return
     */
    public DefBarBuild setTitle(CharSequence title) {
        mTitle = title;
        return this;
    }

    /**
     * 设置Title
     *
     * @param color
     * @return
     */
    public DefBarBuild setBgColor(int color) {
        mBgColor = color;
        return this;
    }

    public DefBarBuild setRightText(CharSequence text) {
        mRightText = text;
        return this;
    }

    public DefBarBuild setRightTextClick(View.OnClickListener listener) {
        mRightTextClickListener = listener;
        return this;
    }

    public DefBarBuild setLeftClick(View.OnClickListener listener) {
        mLeftClickListener = listener;
        return this;
    }

    /**
     * 添加左边的View
     */
    public DefBarBuild addLeftView(int leftLayoutId) {
        mLeftLayoutId = leftLayoutId;
        return this;
    }

    /**
     * 添加左边的View
     */
    public DefBarBuild addLeftView(View leftView) {
        mLeftView = leftView;
        return this;
    }

    /**
     * 添加右边的View
     */
    public DefBarBuild addRightView(int rightLayoutId) {
        mRightLayoutId = rightLayoutId;
        return this;
    }

    /**
     * 添加右边的View
     */
    public DefBarBuild addRightIcons(int[] rightResIcons, View.OnClickListener... rightResClicks) {
        mRightResIcons = rightResIcons;
        mRightResClicks = rightResClicks;
        return this;
    }

    /**
     * 添加右边的View
     */
    public DefBarBuild addRightView(View rightView) {
        mRightView = rightView;
        return this;
    }


    public DefBarBuild setLeftRes(int resId) {
        mLeftResId = resId;
        return this;
    }
}